package com.zhou.sharingjdbc.service;

import com.zhou.sharingjdbc.dao.entity.Dm;
import com.zhou.sharingjdbc.dao.mapper.DmMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhouyongjun
 * @date 2021/3/3019:13
 * @Description:
 */
@Service
public class DmServiceImpl implements IDmService{
    @Autowired
    DmMapper dmMapper;

    @Override
    public Dm getDmById(Integer id) {
        return dmMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Dm> getAll() {
        return dmMapper.selectAll();
    }

    @Override
    public boolean addDm(Dm dm) {
        return dmMapper.insert(dm) > 0;
    }

    @Override
    public boolean deleteDm(Integer id) {
        return dmMapper.deleteByPrimaryKey(id) > 0;
    }
}
